/*
 * @Author: liu.ff 
 * @Date: 2018-09-12 14:07:13 
 * @Last Modified by: liu.ff
 * @Last Modified time: 2018-09-13 17:54:37
 */

import React, {Component} from 'react';
import {StackNavigator} from 'react-navigation'

// 导入页面
import Login from '../../Login/LFLogin'
import FindPwd from '../../Login/LFFindPwd'
import RegAccount from '../../Login/LFReg'

// 导入自定义的TabBar组件
import RootTabNavigator from './LFTabNavigator'


// 导入内置跳转动画的组件
import CardStackStyleInterpolator from 'react-navigation/src/views/CardStack/CardStackStyleInterpolator'

/*配置跳转方式*/
/* 转场动画类似
forHorizontal,横向跳转
forVertical,纵向跳转
forFadeFromBottomAndroid,//从底部渐变
forFade//渐变
*/
const screenInterpolater = (sceneProps) => {
	const {route} = sceneProps.scene;
	const params = route.params || {};
	const transition = params.transition || 'forHorizontal';
	return CardStackStyleInterpolator[transition](sceneProps);
};


const Rootnavigator = StackNavigator(
	{
		// 登陆
		LoginRoute: {
			screen: Login,
			navigationOptions: {
				headerTintColor: '#903ff8'
			}
		},
		// 注册
		RegRoute: {
			screen: RegAccount,
			navigationOptions: {
				headerTintColor: '#903ff8'
			}
		},
		// 忘记密码
		FindPwdRoute: {
			screen: FindPwd,
			navigationOptions: {
				headerTintColor: '#903ff8'
			}
		},

		// TabNavigator主框架
		RootTabRoute: {
			screen: RootTabNavigator,
			navigationOptions: {
				header: null,
				headerTintColor: '#903ff8'
			}
		}
	},

	// stackNavigatorConfig 配置部分
	{
		// 启动app进入登录页
		initialRouteName: 'LoginRoute',
		// 自定义切换的动画
		transitionConfig: (() => ({
			screenInterpolator: screenInterpolater,
		}))
	}
)

export default Rootnavigator

